﻿using System;

namespace _04_Builder
{
    class Program
    {
        /// <summary>
        /// 建造者
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            //小明要制作一个运动水杯
            Builder b1 = new SportCupBuilder();
            Director director = new Director(b1);
            director.Create();
            
            Cup cup = new Cup();
            cup.Drink();

            Console.ReadKey();
        }
    }
    public class Director
    {
        Builder b = null;
        public Director(Builder builder)
        {
            b = builder;
        }
        public void Create()
        {
            b.BuildString();
            b.BuildCap();
            b.BuildBody();
        }
    }
    //我想定制个水杯
    public abstract class Builder
    {
        public abstract void BuildString();
        public abstract void BuildCap();
        public abstract void BuildBody();
    }
    /// <summary>
    /// 运动水杯
    /// </summary>
    public class SportCupBuilder : Builder
    {
        public override void BuildString()
        {
            Console.WriteLine("经历一番工作把杯子绳做好了");
        }
        public override void BuildCap()
        {
            Console.WriteLine("杯盖做好了");
        }
        public override void BuildBody()
        {
            Console.WriteLine("杯子主体做好了");
        }
    }

    //这是我们要制作的水杯
    public class Cup
    {
        private string myString;//绳子
        private string body;  //主体
        private string cap;  //杯盖

        public string MyString
        {
            get { return myString; }
            set { myString = value; }
        }
        public string Body
        {
            get { return body; }
            set { body = value; }
        }
        public string Cap
        {
            get { return cap; }
            set { cap = value; }
        }
        public void Drink()
        {
            Console.WriteLine("喝水。。。吨吨吨");
        }
    }
}
